/* 
   Florence - Florence is a simple virtual keyboard for Gnome.

   Copyright (C) 2008, 2009, 2010 François Agrech

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software Foundation,
   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

*/

#ifndef RAMBLE
#define RAMBLE

#include "system.h"
#ifdef ENABLE_RAMBLE
#include <glib.h>
#include <gdk/gdk.h>
#include "status.h"
/* Create a ramble structure */
#include <cairo.h>

/* Ramble structure is used to track the path of the mouse. */
struct ramble {
        cairo_t* cr;
        struct status *status; /* the status of florence */
	gint xoldpos, yoldpos; /* remember pointer position */
        struct key* key;
        struct key* old_key;
        int occurrence;
        int timeout;
        int timeout_id;
        int max_occurrence;
        int border_threshold;
};

/* Create a ramble structure */
struct ramble *ramble_new();

/* Free the ramble structure */
struct ramble *ramble_free(struct ramble *ramble);

/* Init the ramble path */
void init_rambling(GdkWindow* window, struct key *key, int x, int y,  struct status *status, struct ramble* ramble);

/* Draw ramble path */
gboolean draw_rambling(int x, int y, struct ramble* ramble);

/* End rambling path */
gboolean end_rambling (struct ramble* ramble);

/* This handle the letter border if you exit and reenter a new letter is taken */
gboolean letter_border_rambling(int x, int y, struct status *status, struct key *key, struct ramble* ramble);

/* It is called from a timer to update the samplings */
gboolean poller_rambling(gpointer user_data);

#endif

#endif

